import { CTableCustom } from '@vh-mobile/pro-components';
import MainContainerCustom from '@/components/MainContainerCustom';
import type { IColumnsType } from '@vh-mobile/pro-components/lib/c-table-custom';

export default function DemoTable() {
  const columns: IColumnsType[] = [
    {
      title: '序号',
      dataIndex: 'indexBorder',
      width: 80,
      fixed: 'left',
      valueType: 'indexBorder',
    },
    {
      title: '公司',
      dataIndex: 'id',
      width: 120,
      fixed: 'left',
      valueType: 'link',
      fieldProps: {
        onClick: (val: any, record: any) => {
          console.log('====================================');
          console.log(record);
          console.log('====================================');
        },
      },
    },
    {
      title: '来电数量',
      dataIndex: 'kw1',
      width: 120,
    },
    {
      title: '来访数量',
      dataIndex: 'kw2',
      width: 120,
    },
  ];

  const dataSource = [
    {
      id: 1,
      kw1: 'kw1',
      kw2: 'kw2',
    },
    {
      id: 2,
      kw1: 'kw1',
      kw2: 'kw2',
    },
    {
      id: 3,
      kw1: 'kw1',
      kw2: 'kw2',
    },
  ];

  return (
    <MainContainerCustom>
      <CTableCustom
        rowSelection={{
          onChange: (values) => {
            console.log(values);
          },
          disabledBefore: (val: any, record: any) => {
            console.log(val, record);
            return false;
          },
        }}
        columns={columns}
        dataSource={dataSource}
      />
    </MainContainerCustom>
  );
}
